import Vue from 'vue'
import VueRouter from 'vue-router'
import LayoutIndex from '@/views/layout/Index.vue'
import LoginIndex from '@/views/login/Index.vue'
import MyOrderIndex from '@/views/myorder/Index.vue'
import PayIndex from '@/views/pay/Index.vue'
import ProDetailIndex from '@/views/prodetail/Index.vue'
import SearchIndex from '@/views/search/Index.vue'
import MyCart from '@/views/layout/Cart.vue'
import CateGory from '@/views/layout/CateGory.vue'
import MyHome from '@/views/layout/Home.vue'
import MyUser from '@/views/layout/User.vue'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: LayoutIndex,
    redirect: '/home',
    children: [
      {
        path: '/cart',
        component: MyCart
      },
      {
        path: '/category',
        component: CateGory
      },
      {
        path: '/home',
        component: MyHome
      },
      {
        path: '/myorder',
        component: MyOrderIndex
      },
      {
        path: '/user',
        component: MyUser
      }
    ]
  },
  {
    path: '/login',
    component: LoginIndex
  },
  {
    path: '/pay',
    component: PayIndex
  },
  {
    path: '/productdetail',
    component: ProDetailIndex
  },
  {
    path: '/search',
    component: SearchIndex
  }

]

const router = new VueRouter({
  routes
})

export default router
